package com.ruoyi.shop.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ruoyi.shop.service.StatisticsService;
import com.ruoyi.common.core.web.domain.AjaxResult;

@RestController
@RequestMapping("/statistics")
public class StatisticsController {

    @Autowired
    private StatisticsService statisticsService;

    // 订单统计
    @GetMapping("/orders_info")
    public AjaxResult getOrderStatistics() {
        List<Map<String, Object>> result = statisticsService.getOrderStatistics();
        return AjaxResult.success(result);
    }

    // 商品统计
    @GetMapping("/product_info")
    public AjaxResult getProductStatistics() {
        List<Map<String, Object>> result = statisticsService.getProductStatistics();
        return AjaxResult.success(result);
    }

    // 用户统计
    @GetMapping("/user_info")
    public AjaxResult getUserStatistics() {
        List<Map<String, Object>> result = statisticsService.getUserStatistics();
        return AjaxResult.success(result);
    }

    // 支付方式统计
    @GetMapping("/payment")
    public AjaxResult getPaymentStatistics() {
        List<Map<String, Object>> result = statisticsService.getPaymentStatistics();
        return AjaxResult.success(result);
    }
}
